#apiVersion: v1
#kind: Service
#metadata:
#  name: amf-open5gs-sctp
#  labels:
#    epc-mode: amf
#spec:
#  type: NodePort
#  selector:
#    epc-mode: amf
#  ports:
#    - protocol: SCTP
#      port: 38412
#      targetPort: 38412
#      nodePort: 30412
---
apiVersion: v1
kind: Service
metadata:
  name: {{ .Release.Name }}-amf
  labels:
    epc-mode: amf
spec:
  selector:
    epc-mode: amf
  ports:
    - name: sbi
      protocol: TCP
      port: 80   
      targetPort: 80
    - name: ngap
      protocol: SCTP
      port: 38412
      targetPort: 38412        
---  
apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
kind: Deployment
metadata:
  name: {{ .Release.Name }}-amf-deployment
  labels:
    epc-mode: amf
spec:
  replicas: 1
  selector:
    matchLabels:
      epc-mode: amf
  template:
    metadata:
      labels:
        epc-mode: amf
    spec:    
      containers:
        - name: amf
          image: "{{ .Values.open5gs.image.repository }}:{{ .Values.open5gs.image.tag }}"
          imagePullPolicy: {{ .Values.open5gs.image.pullPolicy }}
          command: ["open5gs-amfd", "-c", "/open5gs/config-map/amf.yaml"]
          volumeMounts:
          - name: {{ .Release.Name }}-amf-config
            mountPath: /open5gs/config-map/amf.yaml
            subPath: "amf.yaml"
      volumes:
        - name: {{ .Release.Name }}-amf-config
          configMap:
            name: {{ .Release.Name }}-amf-config
